package com.coinworld.timer.task;

import com.coinworld.dao.UserDao;
import com.coinworld.producer.SendService;
import com.coinworld.redis.RedisPool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @description user相关
 * @author:
 * @create: 2019-09-21 19:51
 **/
@Component
@Slf4j
public class UserTask {

    @Resource
    private UserDao userDao;
    @Resource
    private SendService sendService;
    @Resource
    private RedisPool redisPool;


    /**
     * 处理等级不符的用户
     */
    //@Scheduled(cron = "0 0 5 * * ? ")
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
    public void updateUserLevel() {
//        try {
//            List<User> users = userDao.findUserLevelDiscrepancyUsers();
//            if (CollectionUtils.isEmpty(users)) {
//                log.info("not found user level discrepancy");
//                return;
//            }
//            users.stream().forEach(user -> {
//                sendService.setDiligenceUpdate(user);
//            });
//        }catch (Exception e){
//            mailService.sendSimpleMail("wangbowen@honeytrip.cn","updateUserLevel error",e.getMessage());
//        }

    }




}
